#include <iostream>
#include <vector>
#include "Thread.hpp"
using namespace ThreadModule;
void print(int &cnt)
{
    while (cnt)
    {
        std::cout << "hello I am myself thread,cnt" << cnt-- << std::endl;
        sleep(1);
    }
}
int num = 10;
int main()
{
    std::vector<Thread<int>> threads;
    for (int i = 0; i < num; i++)
    {
        std::string name = "Thread-" + std::to_string(i);
        threads.emplace_back(print, num, name);
    }
    for (auto &thread : threads)
    {
        thread.Start();
    }
    for (auto &thread : threads)
    {
        thread.Join();
        std::cout << "wait thread done,thread is" << thread.name() << std::endl;
    }
    return 0;
}